<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">
<h:body>

	<p:dialog widgetVar="edictCreateDialogWidget" id="edictCreateDialogId"
		height="400" width="400" modal="true" closable="true"
		draggable="false" resizable="false"
		header="#{bundle.registrationEdict_t}">

		<h:form id="edictCreateDialogForm" prependId="false">

			<h:panelGrid columns="2">

				<h:outputText value="* #{bundle.edict_name}" />
				<h:inputText value="#{edictMB.edict.name}" required="true"
					label="#{bundle.edict_name_t}">
					<f:validateLength minimum="4" />
				</h:inputText>


				<h:outputText value="* #{bundle.edict_name_product}" />
				<p:selectOneMenu value="#{edictMB.edict.idProduct}" converter="productConverter" >
					<f:selectItems value="#{productMB.getlistAllNotUse()}" var="product"
						itemLabel="#{product.name}"  itemValue="#{product}"   />
				</p:selectOneMenu>

				<h:outputText value="* #{bundle.edict_description}" />
				<h:inputTextarea rows="5" cols="20"
					value="#{edictMB.edict.description}" required="true"
					label="#{bundle.edict_description_t}" />

				<h:outputText value="#{bundle.edict_dateTimeStart}" />
				<p:calendar value="#{edictMB.edict.dateTimeStart}"  pattern="MM/dd/yyyy HH:mm" /> 

				<h:outputText value="#{bundle.edict_dateTimeFinish}" />
				<p:calendar value="#{edictMB.edict.dateTimeFinish}" pattern="MM/dd/yyyy HH:mm"/>


				<h:outputText value="* #{bundle.edict_amount}" />
				<h:inputText value="#{edictMB.edict.amount}" required="true"
					label="#{bundle.edict_amount_t}">
				</h:inputText>


				<p:commandButton value="#{bundle.button_inserir}"
					icon="ui-icon-plus" action="#{edictMB.insertEdict()}"
					update=":messageGrowl :edictsForm:edictsTable"
					oncomplete="closeDialogIfSucess(xhr, status, args, edictCreateDialogWidget, 'edictCreateDialogId')" />
				
				<p:commandButton value="#{bundle.button_cancel}"
					icon="ui-icon-cancel" actionListener="#{edictMB.resetEdict()}"
					onclick="edictCreateDialogWidget.hide();" type="button" />
					
			</h:panelGrid>
		</h:form>
	</p:dialog>
</h:body>
</html>